$(function() {
    var currentLoginInfo = JSON.stringify(sessionStorage.getItem("usernfo") || '{}');
    if (currentLoginInfo.name) {
        $("#msg .simp").innerHTML = `欢迎:${currentLoginInfo.name}光临`;
        $("#msg .simp").innerHTML += `<a class='quit' href='JavaScript:void(0)'>退出</a>`
    } else {
        $("#msg .simp").innerHTML = `
            <a href='./login.html'>登录</a>
        `
    }
    
    $("#msg .simp").on("click", function (evt) {
        var e = evt || window.event;
        var ele = e.target || e.srcElement;
        if (ele.nodeName == 'A' && ele.className == 'quit') {
            if (confirm("您确定要退出吗?")) {
                localStorage.removeItem("userInfo");
                location.reload();
            }
        }
    })
})